package com.aaa.controller;

import com.aaa.entity.Dept;
import com.aaa.service.DeptService;
import com.aaa.vo.DeptVo;
import com.aaa.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @program: work713
 * @description:
 * @author: 李梦朝
 * @create: 2024-07-15 10:20
 **/
@RestController
@RequestMapping("/dept")
public class DeptController {
    @Autowired
    private DeptService deptService;
    @GetMapping ("/selectById")
    public Object selectById(Integer deptno)
    {
        return deptService.selectById(deptno);
    }
    @PostMapping ("/insert")
    public Object insert(Dept dept)
    {
        return deptService.insert(dept);
    }
    @DeleteMapping ("/delete")
    public Object delete(Integer deptno)
    {
        return deptService.delete(deptno);
    }
    @PutMapping ("/update")
    public Object update(Dept dept)
    {
        return deptService.update(dept);
    }
    @PostMapping(value = "/selectByPage")
    public R selectByPage(@RequestBody DeptVo deptVo){
        R selectByPage = deptService.selectByPage(deptVo);
        return selectByPage;
    }
}
